package com.tarena.lbs.content.service;

import com.tarena.lbs.content.dao.repository.CategoryRepository;
import com.tarena.lbs.content.pojo.param.ArticleCategoryParam;
import com.tarena.lbs.content.pojo.po.ArticleCategoryPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Slf4j
@Service
public class CategoryServiceImpl implements CategoryService{
@Autowired
private CategoryRepository categoryRepository;
    @Override
    public void insert(ArticleCategoryParam articleCategoryParam) {
        log.debug( "新增分类数据:{}",articleCategoryParam);
        ArticleCategoryPO articleCategoryPO = new ArticleCategoryPO();
        articleCategoryPO.setCreateTime(new Date());
        BeanUtils.copyProperties(articleCategoryParam, articleCategoryPO);
        categoryRepository.insert(articleCategoryPO);


    }
}
